<?php 
//////////////////////
session_start();
require ("lib/Formulaire.lib.php");
$form = new Formulaire("form1", "form_style");

?>
<html>
<head>
<title>Formulaire parametrable</title>

<style>

.form_style select
{
	background:#CCCCCC;
	border:solid #000000 1px;
}

.form_style input
{
	background:#CCCCCC;
	border:solid #000000 1px;
}

.form_style textarea
{
	background:#CCCCCC;
	border:solid #000000 1px;
}


</style>
</head>

<body>
<?php
    
// Formulaire valider
if ($form->formValid($_POST))
{
	echo $form->getValue("nom")."<p>";
	if (!$form->verifEmail($form->getValue("email"))) echo "email incorrect"."<p>";
	if (!$form->verifUrl($form->getValue("site"))) echo "site incorrect"."<p>";
	if (!$form->verifNumeric($form->getValue("cp"), 5)) echo "Code postal incorrect"."<p>";
	echo $form->getValue("desc")."<p>";
	echo $form->getValue("choix")."<p>";
	echo "choix radio : ".$form->getValue("radiochoix")."<p>";
	echo "choix radio2 : ".$form->getValue("radiochoix2")."<p>";
	if ($form->verifCaptcha()) echo "captcha ok";
	
	//$form = new auto_form("form1", "form_style");
}

echo $form->printBegin();
    
?>
<div align="left">
    <table width="80%" border="0" cellspacing="1" cellpadding="1">
        <tr>
            <td width="40%" valign="top"><div align="right">Nom : </div></td>
            <td width="60%"><div align="left"><?php echo $form->printInput("nom", 55, 20); ?></div></td>
        </tr>
        <tr>
            <td width="40%" valign="top"><div align="right">Email : </div></td>
            <td><div align="left"><?php echo $form->printInput("email", 55, 20, ""); ?></div></td>
        </tr>
        <tr>
            <td width="40%" valign="top"><div align="right">Code postal : </div></td>
            <td><div align="left"><?php echo $form->printInput("cp", 10, 5, ""); ?></div></td>
        </tr>
        <tr>
            <td width="40%" valign="top"><div align="right">Votre site web : </div></td>
            <td><div align="left"><?php echo $form->printInput("site", 55, 20, ""); ?></div></td>
        </tr>
        <tr>
            <td width="40%" valign="top"><div align="right">Choix multiple : </div></td>
            <td><div align="left"><?php echo $form->printSelect("choix", array("1" => "Choix 1", "2" => "Choix 2", "3" => "Choix 3"), "2"); ?></div></td>
        </tr>
        <tr>
            <td width="40%" valign="top"><div align="right">Choix multiple Radio : </div></td>
            <td><div align="left"><?php echo $form->printRadio("radiochoix", array("1" => "Choix 1", "2" => "Choix 2", "3" => "Choix 3"), "1", false); ?></div></td>
        </tr>
        <tr>
            <td width="40%" valign="top"><div align="right">Choix multiple Radio avec retour ligne : </div></td>
            <td><div align="left"><?php echo $form->printRadio("radiochoix2", array("1" => "Choix 1", "2" => "Choix 2", "3" => "Choix 3"), "3", true); ?></div></td>
        </tr>
        <tr>
            <td width="40%" valign="top"><div align="right">Description : </div></td>
            <td><div align="left"><?php echo $form->printTextArea("desc", 50, 2, ""); ?></div></td>
        </tr>
        <tr>
            <td width="40%" valign="top"><div align="right">Password : </div></td>
            <td><div align="left"><?php echo $form->printInputPass("password", 12, 4); ?></div></td>
        </tr>
        <tr>
            <td width="40%" valign="top"><div align="right">Verif : </div></td>
            <td><div align="left"><?php echo $form->printCaptcha(); ?></div></td>
        </tr>
        
        <tr>
            <td width="100%" colspan="2"><div align="center"><?php echo $form->printSubmit("Envoyer les infos"); ?></div></td>
        </tr>
    </table>
</div>

<?php echo $form->printEnd(); ?>

</body>
</html>